package com.srxz.mobilepharmacy.controller;

import com.srxz.mobilepharmacy.entity.view.VwMrStk;
import com.srxz.mobilepharmacy.entity.view.VwMrStkParam;
import com.srxz.mobilepharmacy.service.MrService;
import com.srxz.mobilepharmacy.util.back.BackMessage;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.math.BigInteger;
import java.util.List;

/**
 * @ClassName: MrController
 * @author: wgchao
 * @createTime: 2018/12/28 1:55 PM
 * @Description: TODO
 */
@RestController
@RequestMapping("/mph/mr")
public class MrController {
    @Autowired
    private MrService mrService;

    @GetMapping("/stk")
    public BackMessage findStkBroadHeading(String drugName, Integer page, @RequestParam(required = false) Integer ord,@RequestParam(required = false) String asc, HttpSession session){
        return mrService.findStkBroadHeading(drugName, page, ord, asc, session);
    }

    @GetMapping("/stkph")
    public BackMessage findStkOfPh(BigInteger aid, Integer mid, Boolean zero, HttpSession session){
        return mrService.findStkOfPh(aid, mid, zero, session);
    }

    @PostMapping("/savestk")
    public BackMessage saveSTK(@RequestBody List<VwMrStkParam> param, HttpSession session){
        return mrService.saveSTK(param, session);
    }

}
